#include "CCell.h"


CCell::CCell(void):
	m_rowIndex(0),
	m_colIndex(0),
	m_isTouch(false),
	m_pElement(NULL)
{
	this->setPosition(CCPointZero);
}


CCell::~CCell(void)
{
}

void CCell::init(CCPoint point)
{
	this->setPosition(point);
	this->m_pElement = NULL;
}

void CCell::addNewElement(CCNode *newElement)
{
	m_pElement = newElement;
	m_pElement->setAnchorPoint(ccp(0,0)); 
	m_pElement->retain();
	m_pElement->setPosition(m_Position);
}

void CCell::removeElement()
{
	if(m_pElement!=NULL)
	{
		m_pElement->release();
		m_pElement = NULL;
	}
}

int CCell::getRowIndex()
{
	return m_rowIndex;
}

void CCell::setRowIndex(int row)
{
	m_rowIndex = row;
}

int CCell::getColIndex()
{
	return m_colIndex;
}

void CCell::setColIndex(int col)
{
	m_colIndex = col;
}

CCPoint CCell::getPosition()
{
	return m_Position;
}

void CCell::setPosition(CCPoint point)
{
	this->m_Position = point;
}

CCNode* CCell::getElement()
{
	return this->m_pElement;
}

CCRect CCell::getRect()
{
	return CCRectMake(m_Position.x, m_Position.y, C_WIDTH,C_HEIGHT);
}

bool CCell::getIsTouch()
{
	return m_isTouch;
}

void CCell::setIsTouch(bool t)
{
	m_isTouch = t;
}
